﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace 快速切换弹幕模式.QuickExchange
{
   public class XmlHelper
    {
        static XmlHelper xmlhelper;
        XmlDocument doc;
        XmlElement element;
        private XmlHelper()
        {
            try
            {
                doc = new XmlDocument();
                doc.Load(AppDomain.CurrentDomain.BaseDirectory + "Addons\\status.xml");                
                element = (XmlElement)doc.SelectSingleNode("/Addons/快速切换弹幕模式");        
            }
            catch (Exception)
            {

            }
           
        }
        public static XmlHelper getHelper()
        {
            if (xmlhelper == null)
            {
                xmlhelper = new XmlHelper();
            }
            return xmlhelper;
        }
        public string getAttr(string attrName)
        {
            if (element!=null && element.HasAttribute(attrName))
            {  
                foreach (XmlAttribute item in element.Attributes)
                {
                    if (item.Name==attrName)
                    {
                        return item.Value;
                    }
                }
                
            }
            return "false";
        }
    }
}
